//
//  YKQAboutViewController.m
//  YaoKongQi
//
//  Created by ryou on 2021/5/19.
//
#define kykqTitleArray @[@"版本",@"反馈",@"分享",@"隐私"]
#import "YKQAboutViewController.h"

@interface YKQAboutViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *ykqTableView;

@end

@implementation YKQAboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"关于";
    self.ykqTableView.delegate=self;
    self.ykqTableView.dataSource=self;
    self.ykqTableView.separatorStyle=UITableViewCellSeparatorStyleNone;
    self.ykqTableView.backgroundColor=kWhiteColor;
    
    [self ykqBUAdLoadBanner];

    // Do any additional setup after loading the view from its nib.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
  
    UITableViewCell *ykqCell=[tableView cellForRowAtIndexPath:indexPath];
    if (!ykqCell) {
        ykqCell=[[UITableViewCell alloc]init];
    }
    ykqCell.selectionStyle=UITableViewCellSelectionStyleNone;
    ykqCell.backgroundColor=kWhiteColor;
    
    UIImageView *bgimage=[[UIImageView alloc]initWithFrame:CGRectMake(20, 10, kYKQWidth  - 40, 80)];
    bgimage.image=[UIImage imageNamed:@"ykq_icon_white_bg.png"];
    bgimage.contentMode=UIViewContentModeScaleToFill;
    [ykqCell addSubview:bgimage];
    
    UILabel *nameLabel=[[UILabel alloc]initWithFrame:CGRectMake(40, 0, 300, 80)];
    nameLabel.text =  kykqTitleArray[indexPath.row];
    nameLabel.textColor=kBlackColor;
    [bgimage addSubview:nameLabel];
    nameLabel.font=[UIFont systemFontOfSize:18];

    
    if (indexPath.row == 0) {
        UILabel *vLabel=[[UILabel alloc]initWithFrame:CGRectMake(bgimage.frame.size.width - 300 - 40, 0, 300, 80)];
        vLabel.text =  @"v 1.0";
        vLabel.textColor=kBlackColor;
        vLabel.textAlignment=NSTextAlignmentRight;
        [bgimage addSubview:vLabel];
        vLabel.font=[UIFont systemFontOfSize:15];

    }
    else{
        
    }
    return ykqCell;
    
}

- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return kykqTitleArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 100;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
 
    if (indexPath.row >0) {
        [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"https://apps.apple.com/cn/app/id1568491449"] options:@{} completionHandler:nil];
    }
}
@end
